import GraphicType from "./GraphicType";
import DrawContext from "./DrawContext";

export default class DrawActionBase {

    type(){return GraphicType.NONE;}

    constructor() {}

    leftClick(){}

    leftDown(){}

    leftUp(){}

    mouseMove(){}

    start(){}

    stop(){}

    undo(){}

    context(){}

    addEntity(e){
        this.getDataSource().entities.add(e);
    }

    getDataSource(){return DrawContext.dataSource;}

    setDrawCallback(fun){
        this._callback = fun;
    }

    generateId() {
        return (
            (Math.random() * 10000000).toString(16).substr(0, 4) +
            "-" +
            new Date().getTime() +
            "-" +
            Math.random()
                .toString()
                .substr(2, 5)
        );
    }
    generateName() {
        if (!window.guuid) {
            window.guuid = 0;
        }
        window.guuid += 1;
        return "图元" + window.guuid;
    }
}